package com.hiray.demos.ui_architect.litho.image

import android.content.Context
import android.widget.ImageView
import com.facebook.litho.ComponentContext
import com.facebook.litho.annotations.MountSpec
import com.facebook.litho.annotations.OnCreateMountContent
import com.facebook.litho.annotations.OnMount
import com.facebook.litho.annotations.Prop

@MountSpec
object TrivialImageViewSpec {

    @OnCreateMountContent
    fun onCreateMountContent(c: Context): ImageView {
        return ImageView(c)
    }

    @OnMount
    fun onMount(c: ComponentContext, imageView: ImageView, @Prop imageRes: Int) {
        imageView.setImageResource(imageRes)
    }
}